package com.jie.scrollviewwithlistview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.widget.ScrollView;

import java.util.ArrayList;
import java.util.List;

public class ReActivity extends AppCompatActivity {

    private RecyclerView rv;
    private ScrollView sv;
    private RecyclerView rv2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_re);
        initView();
    }

    private void initView() {
        rv = (RecyclerView) findViewById(R.id.rv);
        sv = (ScrollView) findViewById(R.id.sv);
        rv.setLayoutManager(new FullGridLayoutManager(this, 2));
        int i = 0;
        List<String> datas = new ArrayList<>();
        while (i < 20) {
            datas.add("hahahahahaahah" + i++);
        }
        RvAdapter adapter = new RvAdapter(this, datas);
        rv.setAdapter(adapter);
        rv2 = (RecyclerView) findViewById(R.id.rv2);
        rv2.setLayoutManager(new FullGridLayoutManager(this, 3));
        rv2.setAdapter(adapter);
    }
}
